<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // class Person {
        //     constructor(name, age) {
        //         this.name = name;
        //         this.age = age;
        //     }
        //     sayHi() {
        //         console.log('Hi, I am ' + this.name);
        //     }
        // }
        // es5 没有class 抽象一个类的模板 (属性 方法)
        // 属性 构造函数
        function Person(name, age) {
            this.name = name;
            this.age = age;
        }
        Person.prototype = {
            speci: '人',
            sayHi: function() {
                console.log('Hi, I am ' + this.name);
            }
        }
        const su = new Person('su', 18); // 实例对象
        console.log(su.__proto__ == Person.prototype);
        console.log(Person.prototype.constructor = Person);
        console.log(Object.getPrototypeOf(su) == Person.prototype);
    </script>
</body>
</html>